//1.链接mysql 借助第三方的模块
const mysql = require('mysql');
//链接mysql
//创建链接
// var connection = mysql.createConnection({
//     host:'127.0.0.1',
//     port:3306,
//     user:'root',
//     password:'xiaxiang',
//     database:'tedu',
// });
// //进入连接
// connection.connect();
// //执行SQL语句
// connection.query('select * from emp',(error,result)=>{
//     console.log(result[0]);
// });
var connection = mysql.createPool({
    host:'127.0.0.1',
    port:3306,
    user:'root',
    password:'xiaxiang',
    database:'tedu',
    connectionLimit:20
});
pool.query('select * form dept',(err,result)=>{
    if(err) throw err;
    console.log(result);
});

